package com.xnyzc.lhy.order.controller.capi.sidebar;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.common.exception.PangException;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.common.util.CheckUtil;
import com.xnyzc.lhy.order.service.sidebar.IOaCNearbyDriverPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 获取附近车辆
 * @Author zhuyubin
 * @Date 2019/8/16 16:01
 **/
@RestController
@RequestMapping(value = "capi/nearbyDriverPosition")
public class OaCNearbyDriverPositionController {

    @Autowired
    private IOaCNearbyDriverPositionService iOaCNearbyDriverPositionService;

    /**
     * 获取附近车辆信息
     * @param lngClient 经度
     * @param latClient 纬度
     */
    @GetMapping(value = "selectNearbyDriverPositionece")
    public Rv selectNearbyDriverPositionece(String lngClient, String latClient){
        if (CheckUtil.objIsEmpty(lngClient, latClient)){
            throw PangException.create(EErrorCode.missingArg);
        }
        return Rv.wrap(iOaCNearbyDriverPositionService.selectNearbyDriverPosition(lngClient, latClient));
    }
}
